package com.aboo.threadlocal;

import java.util.Random;

public class ThreadLocalFactory {

    private static final ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<>();

    public static void setSession() {
        String random = String.format("%010d", new Random().nextInt(100000000));
        System.out.println("random:" + random);
        THREAD_LOCAL.set(random);
    }

    public static String getSession() {
        return THREAD_LOCAL.get();
    }
}
